package cn.icare.cms.controller.restful;

import cn.icare.cms.ConfigService;
import cn.icare.cms.model.ro.AddADRO;
import cn.icare.cms.model.ro.AddConfigRO;
import cn.icare.cms.model.vo.rest.RespMsgVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

@CrossOrigin
@RestController
@RequestMapping(value = "/rest/config")
@Api(tags = "REST系统配置")
public class ItemDetailConfigController extends BaseController {
    @Autowired
    private ConfigService configService;
    private final String FALL_STRING = "请求失败,服务繁忙!";


    /**
     * 查询商品详情页底部信息
     * @return
     */
    @GetMapping("/itemdetailfooter")
       @ApiOperation(value = "查询商品详情页底部信息", notes = "查询商品详情页底部信息")
    public ResponseEntity<RespMsgVO> getItemDetailFooter() {

       return super.getRespOk(configService.getItemDetailFooter());
    }

    /**
     * 查询商品详情页底部信息
     * @return
     */
    @PostMapping("/itemdetailfooter")
    @ApiOperation(value = "查询商品详情页底部信息", notes = "查询商品详情页底部信息")
    public ResponseEntity<RespMsgVO> saveItemDetailFooter(@RequestBody AddConfigRO ro) {

        return super.getRespOk(configService.saveItemDetailFooter(ro.getKeyValue()));
    }


    //#region fallback methods
     //#endregion

}
